local BuffShow = class("BuffShow")
local FightConst = require("const.FightConst")
local GameUtils = require("utils.GameUtils")
local BuffIcon = require("gameLogic.fightSkill.show.BuffIcon")
local FightHelper = require("gameLogic.fight.FightHelper")

function BuffShow:ctor(manager)
    self._manager = manager
end

function BuffShow:show(buffParam)
    local effectName = FightConst.BUFF_EFFECT_NAME[buffParam.type]
    local buffFunc = self["_" .. effectName]
    local actor = self._manager:findActorbyId(buffParam.entityId)
    local time = 0
    if buffFunc then
        time = buffFunc(self, actor, buffParam)
    end
    return time
end

function BuffShow:_buff_add(actor, buffParam)
    actor:addBuff(buffParam.id)
    actor:setBloodValue(buffParam.blood, buffParam.maxBlood, buffParam.die)
    return 0
end

function BuffShow:_buff_remove(actor, buffParam)
    actor:removeBuff(buffParam.id)
    actor:setBloodValue(buffParam.blood, buffParam.maxBlood, buffParam.die)
    return 0
end

function BuffShow:_buff_affect(actor, buffParam)
    local AttributeConst = require("const.AttributeConst")
    actor:setBloodValue(buffParam.blood, buffParam.maxBlood, buffParam.die)
    if buffParam.atrId == AttributeConst.BLOOD then
        local param = FightHelper.generateHurtFly(actor, buffParam)
        printDebug("_buff_affect <<<<<<<<<<<<<<<<<<<<<<<<<<<<< " .. buffParam.entityId)
        G_SignalManager:dispatch(SignalConst.EVENT_FIGHT_HURT_TEXT, param)
        return 0
    end
    return 0
end

return BuffShow
